import { defineStore } from "pinia";
import type { IUser } from "@/models/user";

export const useUserStore = defineStore("user", {
  state: () => ({
    user: {
      account: "",
      password: "",
    },
  }),
  getters: {
    isLogin() {
      return !!this.userInfo.account;
    },
  },
  actions: {
    handleSetUserInfo(userInfo: IUser) {
      this.user = userInfo;
    },
  },
  persist: true,
});
